#ifndef NONLINEAR_NEWTON_H
#define NONLINEAR_NEWTON_H

#include "IterationState.h"
#include "LinearCGState.h"
#include "DeformationState.h"


class IncrementalNewtonSolver : public IterationState
{
public:
	Array<Real> residual_;
	Array<Real> direction_;

	LinearCGState * cg_state_;
	DeformationState * pstate_; 

	virtual void IterationStep (DeformationState*p);
	virtual void UpdateResidual (DeformationState const*);
	virtual void Reinit (DeformationState const *);
	virtual LinkArray< Array<Real > > VectorVariables();
	virtual bool GoodSolution (DeformationState const*) const;

	int Dimension()const { return residual_.Size(); }

	IncrementalNewtonSolver (DeformationState*);
	~IncrementalNewtonSolver();
};

#endif /* NONLINEAR_NEWTON_H */

